<template>
  <div class="rate">
    <div class="content">
      <div class="m-r-20">
        <span class="titleStyle">{{ info.title }}</span>
        <span class="num">{{ info.num }}</span>
      </div>
      <div class="right">
        <div>
          <span>同比：{{ info.increase }}%</span>
          <div class="m-l-10"></div>
        </div>
        <div>
          <span>环比：{{ info.decrease }}%</span>
          <div class="m-l-10"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Rate",
  props: {
    width: {
      type: String,
      default: "100%",
    },
    height: {
      type: String,
      default: "100%",
    },
    info: {
      type: Object,
      default: () => {
        return {
          title: "共享资源总数",
          num: "19820",
          increase: "12",
          decrease: "12",
        };
      },
    },
  },
};
</script>

<style lang="less" scoped>
.rate {
  background: linear-gradient(180deg, #061234 0%, #093964 100%);
  width: v-bind(width);
  height: v-bind(height);
  display: flex;
  justify-content: center;
  align-items: center;

  .content {
    height: 60%;
    display: flex;
    color: #fff;
    .left {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;

      & > span:nth-of-type(1) {
        font-size: 24px;
        font-weight: bold;
      }
      & > span:nth-of-type(2) {
        font-weight: bold;
      }
    }
    .right {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      height: 35px;
      font-weight: bold;
      background-image: linear-gradient(
        to bottom,
        #6292c8,
        #dbf2ff
      ); // 背景线性渐变
      color: #ffffff; // 兜底颜色，防止文字裁剪不生效
      background-clip: text;
      -webkit-background-clip: text; // 背景被裁减为文字的前景色
      -webkit-text-fill-color: transparent; // 文字填充为透明，优先级比color高。
      & > div {
        font-size: 12px;
        display: flex;
        div {
          border: 6px solid transparent;
        }
      }
      & > div:nth-of-type(1) div {
        margin-bottom: 6px;
        border-bottom: 6px solid #adf242;
      }
      & > div:nth-of-type(2) div {
        margin-top: 6px;
        border-top: 6px solid red;
      }
    }
  }
}
.num {
  font-size: 24px;
  font-weight: bold;
  color: #fdc900;
  position: relative;
  top: 3px;
}
.titleStyle {
  font-weight: bold;
  background-image: linear-gradient(
    to bottom,
    #6292c8,
    #dbf2ff
  ); // 背景线性渐变
  color: #ffffff; // 兜底颜色，防止文字裁剪不生效
  background-clip: text;
  -webkit-background-clip: text; // 背景被裁减为文字的前景色
  -webkit-text-fill-color: transparent; // 文字填充为透明，优先级比color高。
  margin-right: 20px;
}
</style>
